home *** CD-ROM | disk | FTP | other *** search
- NOLIST
- *AUTO: smake KCX
-
- opt o+,ow-,ow6+,NODEBUG,NOLINE
-
- ;* $Revision Header built automatically *************** (do not edit) ************
- ;*
- ;* © Copyright by GuntherSoft
- ;*
- ;* File : KCXLib.Asm
- ;* Created on : Saturday, 03-Oct-92 18:26:03
- ;* Created by : Kai Iske
- ;* Current revision : V2.5
- ;*
- ;*
- ;* Purpose
- ;* -------
- ;* Shared library for support functions for both, KCommodity
- ;* itself and the prefs program
- ;*
- ;* Revision V2.5
- ;* --------------
- ;* --- Initial release ---
- ;*
- ;*********************************************************************************
-
-
- INCLUDE KCXBase.i
- INCLUDE Misc/MyMacros.i
- INCLUDE KCX.i
-
-
- **********************************************************************
- * Local parameters for font-sensitive window open up *
- **********************************************************************
- CARGS #-(4+4+2+2+2+2),OffY.W,OffX.W,FontY.W,FontX.W,FontPtr.L
-
-
- SECTION LibraryBase,CODE
-
-
- **********************************************************************
- * Not startable *
- **********************************************************************
- Start moveq #-1,d0
- rts
-
-
- LIBPRI EQU 0
-
-
- **********************************************************************
- * Romtag definition *
- **********************************************************************
- RomTag dc.w RTC_MATCHWORD
- dc.l RomTag
- dc.l EndOfLibrary
- dc.b RTF_AUTOINIT
- dc.b VERNUM
- dc.b NT_LIBRARY
- dc.b LIBPRI
- dc.l LibName
- dc.l IDString
- dc.l InitTable
-
- LibName KCXNAME
- IDString dc.b "kcx "
- REVISION
- dc.b " ("
- REVDATE
- dc.b ")",13,10,0
- DosName dc.b "dos.library",0
- IntName dc.b "intuition.library",0
- GadName dc.b "gadtools.library",0
- LayersName dc.b "layers.library",0
- LocaleName dc.b "locale.library",0
- EVEN
-
-
-
-
- **********************************************************************
- * Table of items to be used for initialization *
- **********************************************************************
- InitTable dc.l KCXBASE_SIZEOF
- dc.l FuncTable
- dc.l DataTable
- dc.l InitRoutine
-
-
-
- **********************************************************************
- * Jump table for library`s functions *
- **********************************************************************
- FuncTable dc.l Open
- dc.l Close
- dc.l Expunge
- dc.l Null
-
- dc.l BusyWindow
- dc.l UnbusyWindow
- dc.l GetGadgetPtr
- dc.l SetCheckBox
- dc.l SetMXGad
- dc.l SetCycleGad
- dc.l SetStringGad
- dc.l SetIntegerGad
- dc.l SetSliderGad
- dc.l SetTextGad
- dc.l SetPaletteGad
- dc.l SetListViewGad
- dc.l SetListViewLst
- dc.l SetNumberGad
- dc.l GhostGadget
- dc.l ActStringGad
- dc.l ComputeFont
- dc.l ComputeX
- dc.l ComputeY
- dc.l ComPut
- dc.l StrEditFunc
- dc.l FindWindow
- dc.l FreeWindows
- dc.l DisplayError
- dc.l -1
-
-
-
- **********************************************************************
- * Initializaton table for library *
- **********************************************************************
- DataTable INITBYTE LN_TYPE,NT_LIBRARY
- INITLONG LN_NAME,LibName
- INITBYTE LIB_FLAGS,LIBF_SUMUSED|LIBF_CHANGED
- INITWORD LIB_VERSION,VERNUM
- INITWORD LIB_REVISION,REVNUM
- INITLONG LIB_IDSTRING,IDString
- dc.l 0
-
-
-
-
- **********************************************************************
- * Main init routine, when library is first loaded to memory *
- **********************************************************************
- InitRoutine movem.l LibRegs,-(sp)
-
- move.l d0,a4
- move.l a6,kb_SysBase(a4)
- move.l a0,kb_SegList(a4)
-
- lea DosName(pc),a1
- moveq #37,d0
- DOLIB OpenLibrary
- move.l d0,kb_DosBase(a4)
- bne.s .GotDOS
- ALERT AG_OpenLib|AO_DOSLib
- bra .Error
- .GotDOS lea IntName(pc),a1
- moveq #37,d0
- DOLIB OpenLibrary
- move.l d0,kb_IntBase(a4)
- bne.s .GotINT
- ALERT AG_OpenLib|AO_Intuition
- bra .Error
- .GotINT lea GadName(pc),a1
- moveq #37,d0
- DOLIB OpenLibrary
- move.l d0,kb_GadBase(a4)
- bne.s .GotGAD
- ALERT AG_OpenLib|AO_GadTools
- bra.s .Error
- .GotGAD lea LayersName(pc),a1
- moveq #37,d0
- DOLIB OpenLibrary
- move.l d0,kb_LayersBase(a4)
- bne.s .GotLay
- ALERT AG_OpenLib|AO_LayersLib
- bra.s .Error
- .GotLay lea LocaleName(pc),a1
- moveq #38,d0
- DOLIB OpenLibrary
- move.l d0,kb_LocaleBase(a4)
- tst.l d0
- beq.s .End
- move.l d0,a6
- sub.l a0,a0
- lea CatalogName(pc),a1
- sub.l a2,a2
- DOLIB OpenCatalogA
- move.l d0,kb_Catalog(a4)
- move.l kb_SysBase(a4),a6
- .End move.l a4,d0
- movem.l (sp)+,LibRegs
- rts
- .Error moveq #0,d0
- movem.l (sp)+,LibRegs
- rts
- CatalogName dc.b "kcxlib.catalog",0
- EVEN
-
-
-
-
-
- **********************************************************************
- * This is the routine called on every OpenLibrary *
- **********************************************************************
- Open addq.w #1,LIB_OPENCNT(a6)
- bclr #LIBB_DELEXP,kb_Flags(a6)
- move.l a6,d0
- rts
-
-
-
-
- **********************************************************************
- * Close down one access to the library *
- **********************************************************************
- Close moveq #0,d0
- subq.w #1,LIB_OPENCNT(a6)
- bne.s .GoOn
- btst #LIBB_DELEXP,kb_Flags(a6)
- beq.s .GoOn
- bsr.s Expunge
- .GoOn rts
-
-
-
- **********************************************************************
- * Remove ourself *
- **********************************************************************
- Expunge movem.l d1-d7/a0-a6,-(sp)
- move.l a6,a4
- move.l kb_SysBase(a4),a6
- tst.w LIB_OPENCNT(a4)
- beq.s .GoOn
- bset #LIBB_DELEXP,kb_Flags(a4)
- moveq #0,d0
- bra.s .End
- .GoOn move.l kb_SegList(a4),d2
- move.l a4,a1
- DOLIB Remove
-
- move.l kb_DosBase(a4),a1
- DOLIB CloseLibrary
- move.l kb_IntBase(a4),a1
- DOLIB CloseLibrary
- move.l kb_GadBase(a4),a1
- DOLIB CloseLibrary
- move.l kb_LayersBase(a4),a1
- DOLIB CloseLibrary
- tst.l kb_LocaleBase(a4)
- beq.s .NoLoc
- move.l kb_Catalog(a4),a0
- move.l a6,-(sp)
- move.l kb_LocaleBase(a4),a6
- DOLIB CloseCatalog
- move.l (sp)+,a6
- move.l kb_LocaleBase(a4),a1
- DOLIB CloseLibrary
- .NoLoc moveq #0,d0
- move.l a4,a1
- move.w LIB_NEGSIZE(a4),d0
- sub.l d0,a1
- add.w LIB_POSSIZE(a4),d0
- DOLIB FreeMem
- move.l d2,d0
- .End movem.l (sp)+,d1-d7/a0-a6
- rts
-
-
- **********************************************************************
- * Just a dummy *
- **********************************************************************
- Null moveq #0,d0
- rts
-
-
-
-
- **********************************************************************
- * Font-sensitive routines *
- **********************************************************************
- ComputeX move.l d1,-(sp)
- move.w FontX(a5),d1
- bra.s ComputeIt
- ComputeY move.l d1,-(sp)
- move.w FontY(a5),d1
- ComputeIt mulu d1,d0
- addq.w #4,d0
- divu #8,d0
- move.l (sp)+,d1
- rts
- ComputeFont move.l FontPtr(a5),a0
- move.l -4(a5),a1
- lea.l sc_RastPort(a1),a1
- move.l rp_Font(a1),a1
- move.l LN_NAME(a1),ta_Name(a0)
- move.w tf_YSize(a1),ta_YSize(a0)
- move.b #FS_NORMAL,ta_Style(a0)
- move.b tf_Flags(a1),ta_Flags(a0)
- move.w tf_XSize(a1),FontX(a5)
- addq.w #1,FontX(a5)
- move.w tf_YSize(a1),FontY(a5)
- move.l -4(a5),a0
- moveq #0,d0
- move.b sc_WBorLeft(a0),d0
- move.w d0,OffX(a5)
- move.l sc_Font(a0),a1
- move.w ta_YSize(a1),d0
- addq.w #1,d0
- moveq #0,d1
- move.b sc_WBorTop(a0),d1
- add.w d1,d0
- move.w d0,OffY(a5)
- tst.w d2
- beq.s CompDone
- tst.w d3
- beq.s CompDone
- move.w d2,d0
- bsr ComputeX
- add.w OffX(a5),d0
- moveq #0,d1
- move.b sc_WBorRight(a0),d1
- add.w d1,d0
- cmp.w sc_Width(a0),d0
- bhi.s UseTopaz
- move.w d3,d0
- bsr ComputeY
- add.w OffY(a5),d0
- moveq #0,d1
- move.b sc_WBorBottom(a0),d1
- add.w d1,d0
- cmp.w sc_Height(a0),d0
- bhi.s UseTopaz
- CompDone rts
- UseTopaz move.l FontPtr(a5),a0
- lea FontName(pc),a1
- move.l a1,ta_Name(a0)
- moveq #8,d0
- move.w d0,ta_YSize(a0)
- move.b #FS_NORMAL,ta_Style(a0)
- move.b #FPF_ROMFONT,ta_Flags(a0)
- move.w d0,FontY(a5)
- move.w d0,FontX(a5)
- rts
-
-
- **********************************************************************
- * Set busy for a window and disable all it`s gadgets *
- * A0 = Pointer to window *
- **********************************************************************
- BusyWindow movem.l RegsAll,-(sp)
- move.l a0,d0
- beq.s .EndBusy
- move.l a0,a3
- clr.l wd_UserData(a3)
- move.l #rq_SIZEOF,d0
- move.l #MEMF_CLEAR|MEMF_PUBLIC,d1
- LIBLIB AllocVec,kb_SysBase
- tst.l d0
- beq.s .EndBusy
- move.l d0,a0 ; Open Requester
- move.l a3,a1
- move.l d0,wd_UserData(a1) ; Store pointer to structure
- LIBLIB Request,kb_IntBase
- move.l a3,a0
- lea BusyPtr,a1
- moveq #16,d0
- moveq #16,d1
- moveq #-6,d2
- moveq #0,d3
- LIBLIB SetPointer,kb_IntBase
- .EndBusy movem.l (sp)+,RegsAll
- rts
-
-
-
-
-
- **********************************************************************
- * Un-Busy a window and reenable all gadgets again *
- * A0 = Pointer to window to be re-enabled *
- **********************************************************************
- UnbusyWindow movem.l RegsAll,-(sp)
- move.l a0,d0
- beq.s .EndBusy
- move.l a0,a3 ; Clear pointer
- move.l a0,a1
- move.l wd_UserData(a0),a0
- LIBLIB EndRequest,kb_IntBase
- move.l wd_UserData(a3),a1
- LIBLIB FreeVec,kb_SysBase
- move.l a3,a0
- LIBLIB ClearPointer,kb_IntBase
- .EndBusy movem.l (sp)+,RegsAll
- rts
-
-
-
-
- **********************************************************************
- * Set a checkbox to specified value *
- * D0 = Mode *
- * D1 = Number of gadget *
- * A0 = Address of GadgetList *
- * A1 = Address of window *
- **********************************************************************
- SetCheckBox movem.l RegsAll,-(sp)
- move.l a1,d2
- beq.s .End
- link a5,#-12
- lea -12(a5),a3
- move.l #GTCB_Checked,(a3)
- and.l #$000000ff,d0
- move.l d0,4(a3) ; Set tag state
- move.l #TAG_DONE,8(a3)
- move.l d1,d0
- bsr GetGadgetPtr
- sub.l a2,a2
- LIBLIB GT_SetGadgetAttrsA,kb_GadBase
- unlk a5
- .End movem.l (sp)+,RegsAll
- rts
-
-
-
- **********************************************************************
- * Set MX Gadget to specified value *
- * D0 = Number of gadget *
- * D1 = Number of button to activate *
- * A0 = Address of GadgetList *
- * A1 = Address of window *
- * A2 = Address of tags *
- **********************************************************************
- SetMXGad movem.l RegsAll,-(sp)
- move.l a1,d2
- beq.s .End
- and.l #$000000ff,d0
- bsr GetGadgetPtr
- link a5,#-12
- lea -12(a5),a3
- move.l #GTMX_Active,(a3)
- move.l d1,4(a3)
- move.l #TAG_DONE,8(a3)
- sub.l a2,a2
- LIBLIB GT_SetGadgetAttrsA,kb_GadBase
- unlk a5
- .End movem.l (sp)+,RegsAll
- rts
-
-
-
-
- **********************************************************************
- * Set a cycle gadget to a specified value *
- * D0 = Number of gadget *
- * D1 = Number of active item *
- * A0 = Address of GadgetList *
- * A1 = Pointer to window *
- **********************************************************************
- SetCycleGad movem.l RegsAll,-(sp)
- move.l a1,d2
- beq.s .End
- bsr.s GetGadgetPtr
- link a5,#-12
- lea -12(a5),a3
- move.l #GTCY_Active,(a3)
- move.l d1,4(a3)
- move.l #TAG_DONE,8(a3)
- sub.l a2,a2
- LIBLIB GT_SetGadgetAttrsA,kb_GadBase
- unlk a5
- .End movem.l (sp)+,RegsAll
- rts
-
-
-
-
- **********************************************************************
- * Set the contents of a string gadget *
- * D0 = Number of gadget *
- * A0 = Address of GadgetList *
- * A1 = Pointer to window *
- * A2 = Pointer to string *
- **********************************************************************
- SetStringGad movem.l RegsAll,-(sp)
- move.l a1,d2
- beq.s .End
- bsr.s GetGadgetPtr
- link a5,#-12
- lea -12(a5),a3
- move.l #GTST_String,(a3)
- move.l a2,4(a3)
- move.l #TAG_DONE,8(a3)
- sub.l a2,a2
- LIBLIB GT_SetGadgetAttrsA,kb_GadBase
- unlk a5
- .End movem.l (sp)+,RegsAll
- rts
-
-
- **********************************************************************
- * Get Address of a gadget *
- * D0 = Number of gadget *
- * A0 = Pointer to first gadget *
- **********************************************************************
- GetGadgetPtr lsl.l #2,d0
- move.l 0(a0,d0),a0
- rts
-
-
-
- **********************************************************************
- * Set the contents of an integer gadget *
- * D0 = Number of gadget *
- * D1 = New value *
- * A0 = Address of GadgetList *
- * A1 = Pointer to window *
- **********************************************************************
- SetIntegerGad movem.l RegsAll,-(sp)
- move.l a1,d3
- beq.s .End
- bsr GetGadgetPtr
- link a5,#-12
- lea -12(a5),a3
- move.l #GTIN_Number,(a3)
- move.l d1,4(a3)
- move.l #TAG_DONE,8(a3)
- sub.l a2,a2
- LIBLIB GT_SetGadgetAttrsA,kb_GadBase
- unlk a5
- .End movem.l (sp)+,RegsAll
- rts
-
-
-
-
- **********************************************************************
- * Set a slider gadget *
- * D0 = GadgetNumber *
- * D1 = New level *
- * A0 = Pointer to GadList *
- * A1 = Pointer to window *
- **********************************************************************
- SetSliderGad movem.l RegsAll,-(sp)
- move.l a1,d5
- beq.s .End
- bsr GetGadgetPtr
- link a5,#-12
- lea -12(a5),a3
- move.l #GTSL_Level,(a3)
- move.l d1,4(a3)
- move.l #TAG_DONE,8(a3)
- sub.l a2,a2
- LIBLIB GT_SetGadgetAttrsA,kb_GadBase
- unlk a5
- .End movem.l (sp)+,RegsAll
- rts
-
-
-
- **********************************************************************
- * Set a TextGadget to new values *
- * D0 = Number of gadget *
- * A0 = Pointer to gadget list *
- * A1 = Pointer to window *
- * A2 = Pointer to text *
- **********************************************************************
- SetTextGad movem.l RegsAll,-(sp)
- move.l a1,d1
- beq.s .End
- bsr GetGadgetPtr
- link a5,#-12
- lea -12(a5),a3
- move.l #GTTX_Text,(a3)
- move.l a2,4(a3)
- move.l #TAG_DONE,8(a3)
- sub.l a2,a2
- LIBLIB GT_SetGadgetAttrsA,kb_GadBase
- unlk a5
- .End movem.l (sp)+,RegsAll
- rts
-
-
- **********************************************************************
- * Set a palette gadget *
- * D0 = GadgetNumber *
- * D1 = Number of color *
- * A0 = Pointer to GadList *
- * A1 = Pointer to window *
- **********************************************************************
- SetPaletteGad movem.l RegsAll,-(sp)
- move.l a1,d5
- beq.s .End
- bsr GetGadgetPtr
- link a5,#-12
- lea -12(a5),a3
- move.l #GTPA_Color,(a3)
- move.l d1,4(a3)
- move.l #TAG_DONE,8(a3)
- sub.l a2,a2
- LIBLIB GT_SetGadgetAttrsA,kb_GadBase
- unlk a5
- .End movem.l (sp)+,RegsAll
- rts
-
-
- **********************************************************************
- * Set a ListView gadget *
- * D0 = GadgetNumber *
- * D1 = Active item *
- * D2 = Top item *
- * A0 = Pointer to GadList *
- * A1 = Pointer to window *
- **********************************************************************
- SetListViewGad movem.l RegsAll,-(sp)
- move.l a1,d5
- beq.s .End
- bsr GetGadgetPtr
- link a5,#-20
- lea -20(a5),a3
- ext.l d1
- ext.l d2
- move.l #GTLV_Selected,(a3)
- move.l d1,4(a3)
- move.l #GTLV_Top,8(a3)
- move.l d2,12(a3)
- move.l #TAG_DONE,16(a3)
- sub.l a2,a2
- LIBLIB GT_SetGadgetAttrsA,kb_GadBase
- unlk a5
- .End movem.l (sp)+,RegsAll
- rts
-
-
-
- **********************************************************************
- * Set a ListView gadget *
- * D0 = GadgetNumber *
- * A0 = Pointer to GadList *
- * A1 = Pointer to window *
- * A2 = New list *
- **********************************************************************
- SetListViewLst movem.l RegsAll,-(sp)
- move.l a1,d5
- beq.s .End
- bsr GetGadgetPtr
- link a5,#-12
- lea -12(a5),a3
- move.l #GTLV_Labels,(a3)
- move.l a2,4(a3)
- move.l #TAG_DONE,8(a3)
- sub.l a2,a2
- LIBLIB GT_SetGadgetAttrsA,kb_GadBase
- unlk a5
- .End movem.l (sp)+,RegsAll
- rts
-
-
-
-
-
-
- **********************************************************************
- * Set a number gadget *
- * D0 = GadgetNumber *
- * D1 = New number *
- * A0 = Pointer to GadList *
- * A1 = Pointer to window *
- **********************************************************************
- SetNumberGad movem.l RegsAll,-(sp)
- move.l a1,d5
- beq.s .End
- bsr GetGadgetPtr
- link a5,#-12
- lea -12(a5),a3
- move.l #GTNM_Number,(a3)
- move.l d1,4(a3)
- move.l #TAG_DONE,8(a3)
- sub.l a2,a2
- LIBLIB GT_SetGadgetAttrsA,kb_GadBase
- unlk a5
- .End movem.l (sp)+,RegsAll
- rts
-
-
-
-
-
-
- **********************************************************************
- * Ghost a gadget *
- * D0 = Number of gadget *
- * D1 = State *
- * A0 = Pointer to gadgetlist *
- * A1 = Pointer to window *
- **********************************************************************
- GhostGadget movem.l RegsAll,-(sp)
- move.l a1,d2
- beq.s .End
- bsr GetGadgetPtr
- link a5,#-12
- lea -12(a5),a3
- move.l #GA_Disabled,(a3)
- move.l d1,4(a3)
- move.l #TAG_DONE,8(a3)
- sub.l a2,a2
- LIBLIB GT_SetGadgetAttrsA,kb_GadBase
- unlk a5
- .End movem.l (sp)+,RegsAll
- rts
-
-
-
- **********************************************************************
- * Activate a string gadget *
- * D0 = Number of gadget *
- * A0 = Pointer to GadgetList *
- * A1 = Pointer to Window *
- **********************************************************************
- ActStringGad movem.l RegsAll,-(sp)
- move.l a1,d1
- beq.s .End
- bsr GetGadgetPtr
- sub.l a2,a2
- LIBLIB ActivateGadget,kb_IntBase
- movem.l (sp)+,RegsAll
- .End rts
-
-
-
-
- **********************************************************************
- * Send a message to the other one and wait *
- * A0 = Pointer to receiver`s port *
- * A1 = Pointer to our port *
- * D0 = Type of message *
- * RET: D0 = ReturnValue *
- **********************************************************************
- ComPut movem.l d1-d7/a2-a6,-(sp)
- move.l a0,d7
- beq.s .End
- CALLSYS Forbid
- link a5,#-cmsg_SIZEOF
- lea -cmsg_SIZEOF(a5),a2
- clr.l LN_SUCC(a2)
- clr.l LN_PRED(a2)
- move.b #NT_MESSAGE,LN_TYPE(a2)
- clr.b LN_PRI(a2)
- clr.l LN_NAME(a2)
- move.l a1,MN_REPLYPORT(a2)
- move.w #cmsg_SIZEOF,MN_LENGTH(a2)
- move.w d0,cmsg_Type(a2)
- clr.l cmsg_RetValue(a2)
- move.l a1,-(sp)
- move.l a2,a1
- DOLIB PutMsg
- DOLIB Permit
- move.l (sp)+,a2
- .Loop move.l a2,a0
- DOLIB WaitPort
- tst.l d0
- beq.s .Loop
- move.l d0,a1
- move.l cmsg_RetValue(a1),d7
- DOLIB Remove
- move.l d7,d0
- unlk a5
- .End movem.l (sp)+,d1-d7/a2-a6
- rts
-
-
-
- **********************************************************************
- * Edit Hook for String/Integer gadgets *
- * A0 = Pointer to Hook itself *
- * A1 = Pointer to parameter *
- * A2 = Pointer to SGWork-Structure *
- * Provided editing is : *
- * Activating the next gadget on RETURN press *
- * Actuvating the previous gadget on CONTROL RETURN press *
- * Simulating HELP-Exit of gadget on ESC-Press *
- * Accessing menus via Key-Stroke RIGHT AMIGA - ShortCut *
- * Using CURSOR UP/DOWN for entering previous/next gadget *
- * Using CONTROL CURSOR LEFT/RIGHT to get to the prev/next word *
- **********************************************************************
- StrEditFunc movem.l RegsAll,-(sp)
- cmp.l #SGH_KEY,0(a1) ; Key pressed ?
- bne .End
- move.l sgw_Actions(a2),d0
- move.l d0,d1
- and.l #SGA_END,d0 ; Gadget released ?
- beq.s .NoReturn ; Nope -> go on
- cmp.w #HELPKEY,sgw_Code(a2) ; HELP used to escape ?
- beq.s .NoReturn ; Yep -> go on
- move.l sgw_IEvent(a2),a3
- move.w ie_Qualifier(a3),d2
- and.w #(IEQUALIFIER_CONTROL),d2
- beq.s .NextGadget
- or.l #SGA_PREVACTIVE,d1 ; On control previous gadget
- bra.s .ActGadget
- .NextGadget or.l #SGA_NEXTACTIVE,d1
- .ActGadget move.l d1,sgw_Actions(a2)
- bra .End
-
- .NoReturn move.l sgw_IEvent(a2),a3 ; User pressed ESC ?
- cmp.w #RESCKEY,ie_Code(a3)
- bne.s .NoEsc
- move.l #SGA_END,sgw_Actions(a2) ; Simulate release of gadget
- move.w #HELPKEY,sgw_Code(a2)
- bra .End
- .NoEsc cmp.w #$4c,ie_Code(a3) ; Cursor UP ?
- bne.s .NoUp
- move.l #SGA_END|SGA_PREVACTIVE,sgw_Actions(a2)
- move.w #$44,sgw_Code(a2)
- bra .End
- .NoUp cmp.w #$4d,ie_Code(a3) ; Cursor DOWN ?
- bne.s .NoDown
- move.l #SGA_END|SGA_NEXTACTIVE,sgw_Actions(a2)
- move.w #$44,sgw_Code(a2)
- bra .End
- .NoDown move.w ie_Qualifier(a3),d0
- and.w #IEQUALIFIER_CONTROL,d0 ; CONTROL pressed ?
- beq .NoWordJump
- move.l sgw_WorkBuffer(a2),a1 ; Get pointer to buffer
- move.w sgw_BufferPos(a2),d0 ; Get cursor position
- cmp.w #$4f,ie_Code(a3) ; Jump to left word ?
- beq.s .JumpLeft
- cmp.w #$4e,ie_Code(a3) ; Jump to right word ?
- beq.s .JumpRight
- bra .NoWordJump
- .JumpLeft tst.w d0 ; Already at beginning ?
- beq .End
- moveq #-1,d1 ; Set new position
- .LeftLoop1 tst.w d0 ; All done ?
- blt.s .FirstLeft ; Yep -> first loop donw
- cmp.b #' ',0(a1,d0.w) ; Got a space ?
- beq.s .NoCharLeft ; Yep -> loop
- move.w d0,d1 ; Nope -> Store new position
- bra.s .FirstLeft
- .NoCharLeft subq.w #1,d0 ; Next char to the left
- bra.s .LeftLoop1
- .FirstLeft cmp.w #-1,d1 ; Got new position ?
- bne.s .NoNegLeft
- moveq #0,d1 ; Nope -> clear position
- .NoNegLeft tst.w d1 ; New position marked ?
- beq.s .JumpedLeft ; Nope -> jump to first char
- move.w d1,d0 ; Copy new position
- moveq #-1,d1 ; Clear position
- .LeftLoop2 tst.w d0 ; Already at first char ?
- blt.s .JumpedLeft ; Yep -> position cursor
- cmp.b #' ',0(a1,d0.w) ; Now skip chars different to space
- bne.s .NoSpaceLeft
- move.w d0,d1 ; Store first pos of char after space
- addq.w #1,d1
- bra.s .JumpedLeft ; DONE
- .NoSpaceLeft subq.w #1,d0 ; Loop for chars
- bra .LeftLoop2
- .JumpedLeft tst.w d1 ; Do we have a new position ?
- bge.s .GotLeft ; Yep -> Repos
- clr.w sgw_BufferPos(a2) ; Set cursor to first char
- bra.s .LeftDone
- .GotLeft move.w d1,sgw_BufferPos(a2) ; Set cursor to new position
- .LeftDone move.w #EO_MOVECURSOR,sgw_EditOp(a2)
- bra .End
-
- .JumpRight cmp.w sgw_NumChars(a2),d0 ; Already at end of string ?
- beq .End ; Yep -> no movement
- moveq #-1,d1
- .RightLoop cmp.w sgw_NumChars(a2),d0 ; All chars checked ?
- beq.s .JumpedRight ; Yep -> end of movement
- cmp.b #' ',0(a1,d0.w) ; Space encountered ?
- bne.s .NoSpaceRight ; Nope -> go on
- .RightSpaceLoop cmp.w sgw_NumChars(a2),d0 ; All chars checked ?
- beq.s .JumpedRight ; Yep -> end of movement
- cmp.b #' ',0(a1,d0.w) ; Still a space ?
- beq.s .NoRightChar ; Yep -> loop for spaces
- move.w d0,d1 ; Got new word
- bra.s .JumpedRight ; -> Do movement
- .NoRightChar addq.w #1,d0 ; Next char (SPACE)
- bra .RightSpaceLoop ; Loop for spaces
- .NoSpaceRight addq.w #1,d0 ; Loop for normal chars
- bra .RightLoop
- .JumpedRight tst.w d1 ; Got new position ?
- bge.s .GotRight ; Yep -> do so
- move.w sgw_NumChars(a2),sgw_BufferPos(a2)
- bra.s .RightDone
- .GotRight move.w d1,sgw_BufferPos(a2) ; Store new position
- .RightDone move.w #EO_MOVECURSOR,sgw_EditOp(a2)
- bra.s .End
-
- .NoWordJump move.l sgw_IEvent(a2),a3
- move.w ie_Qualifier(a3),d0 ; Right Amiga pressed ?
- and.w #IEQUALIFIER_RCOMMAND,d0
- beq.s .NoAmiga
- cmp.w #96,ie_Code(a3) ; Char entered ?
- bge.s .NoAmiga
- move.w ie_Qualifier(a3),d0 ; Any shift pressed ?
- and.w #(IEQUALIFIER_LSHIFT|IEQUALIFIER_RSHIFT),d0
- bne.s .DoMenu
- cmp.w #$32,ie_Code(a3) ; Magic X
- beq.s .NoAmiga
- cmp.w #$10,ie_Code(a3) ; or Q pressed ?
- beq.s .NoAmiga
- .DoMenu move.l sgw_Actions(a2),d0 ; Ok -> Then use the menues
- or.l #(SGA_END|SGA_REUSE),d0
- and.l #~(SGA_USE|SGA_BEEP),d0
- move.l d0,sgw_Actions(a2)
- move.l sgw_GadgetInfo(a2),a0
- bra.s .End
- .NoAmiga
- .End movem.l (sp)+,RegsAll
- rts
-
-
-
-
- **********************************************************************
- * Find underneith mousepointer *
- **********************************************************************
- FindWindow movem.l d2-d7/a2-a6,-(sp)
- moveq #0,d0 ; Lock Intuition-Base
- LIBLIB LockIBase,kb_IntBase
- move.l kb_IntBase(a6),a0
- move.l ib_FirstScreen(a0),a3
- move.l d0,a0
- LIBLIB UnlockIBase,kb_IntBase
-
- LIBLIB Forbid,kb_SysBase
-
- move.l a3,a0
-
- .CheckScreens moveq #0,d0
- moveq #0,d1
- move.w sc_MouseX(a0),d0
- move.w sc_MouseY(a0),d1
-
- movem.l a0/d1,-(sp) ; Check layer
- lea sc_LayerInfo(a0),a0
- LIBLIB WhichLayer,kb_LayersBase
- movem.l (sp)+,a0/d1
- tst.l d0
- bne.s GotLayer
-
- move.l sc_NextScreen(a0),a0 ; Next Screen
- move.l a0,d3 ; No more screens ?
- beq.s ScreenError ; Error
- bra.s .CheckScreens ; Find screen
-
- ScreenError moveq #0,d0
- GotLayer LIBLIB Permit,kb_SysBase
- movem.l (sp)+,d2-d7/a2-a6
- rts
-
-
-
-
- **********************************************************************
- * Free list of windows *
- **********************************************************************
- FreeWindows movem.l a2/a6,-(sp)
- move.l a0,a2
- move.l a2,-(sp)
- TSTLIST a2
- beq.s .Done
- move.l LH_HEAD(a2),a2
- .FreeEntries move.l a2,a1
- SUCC a2,a2
- CALLSYS FreeVec
- tst.l (a2)
- beq.s .Done
- bra.s .FreeEntries
- .Done move.l (sp)+,a0
- NEWLIST a0
- movem.l (sp)+,a2/a6
- rts
-
-
-
-
- **********************************************************************
- * Display an error *
- **********************************************************************
- DisplayError movem.l d1-d7/a0-a6,-(sp)
-
- cmp.l #500,d0 ; Printer Error ?
- blt.s .NoPrintError
- sub.l #500,d0
- lea PrinterErrors(pc),a0
- lsl.l #2,d0
- move.l 0(a0,d0),a0
- bra.s .DosError
-
- .NoPrintError cmp.l #400,d0 ; IFF Error ?
- blt.s .NoIFFError
- sub.l #400,d0
- lea IFFErrors,a0
- lsl.l #2,d0
- move.l 0(a0,d0),a0
- bra.s .DosError
-
- .NoIFFError cmp.l #200,d0 ; Display DOS error ?
- blt.s .OurError ; Nope -> go on
- move.l d0,d1
- opt ow6-
- LOCLEA DosError(pc),a0
- opt ow6+
- move.l a0,d2
- lea DosErrorBuff(pc),a0
- move.l a0,d3
- move.l #128,d4
- LIBLIB Fault,kb_DosBase
- lea DosErrorBuff(pc),a0
- bra.s .DosError
-
- .OurError lea EasyTexts(pc),a0
- lsl.l #2,d0
- move.l 0(a0,d0),a0 ; get adr of error-txt
- .DosError move.l a0,d0
- beq.s .End
- lea MyEasyRequest(pc),a1 ; Display Easy-Requester
- move.l #EasyTitle,es_Title(a1)
- move.l a0,-(sp)
- bsr.s GetLocStr
- move.l (sp)+,es_TextFormat(a1)
- move.l #EasyGadget,es_GadgetFormat(a1)
- sub.l a0,a0
- sub.l a2,a2
- LIBLIB EasyRequestArgs,kb_IntBase
- .End movem.l (sp)+,d1-d7/a0-a6
- rts
-
-
-
-
-
- **********************************************************************
- * Get a string froma locale *
- **********************************************************************
- GetLocStr movem.l d0-d1/a0-a1/a6,-(sp)
- move.l kb_Catalog(a6),d1
- beq.s .End
- move.l 24(sp),d0
- beq.s .End
- move.l d0,a1
- moveq #0,d0
- move.l a1,d1
- lea LOCALE_END(pc),a0
- cmp.l a0,d1
- bgt.s .End
- lea LOCALE_START(pc),a0
- cmp.l a0,d1
- blt.s .End
- sub.l a0,d1
- beq.s .GetIt
-
- .Loop tst.b (a0)+
- bne.s .Ok
- addq.l #1,d0
- .Ok subq.l #1,d1
- bne.s .Loop
-
- .GetIt move.l kb_Catalog(a6),a0
- LIBLIB GetCatalogStr,kb_LocaleBase
- move.l d0,24(sp)
- .End movem.l (sp)+,d0-d1/a0-a1/a6
- rts
-
-
-
-
-
- **********************************************************************
- * Easy-Requeststructure *
- **********************************************************************
- MyEasyRequest dc.l es_SIZEOF
- dc.l 0
- dc.l 0
- dc.l 0
- dc.l 0
- EasyGadget dc.b "OK",0
- EVEN
-
-
-
- **********************************************************************
- * Error-Texts *
- **********************************************************************
- EasyTitle dc.b "KCommodity V"
- REVISION
- EasyTitleEnd dc.b 0
- EVEN
- EasyTexts dc.l EZTxt1,EZTxt2,EZTxt3,EZTxt4,EZTxt5,EZTxt6,EZTxt7,EZTxt8
- dc.l EZTxt9,EZTxt10,EZTxt11,EZTxt12,EZTxt13,EZTxt14,EZTxt15,EZTxt16
- dc.l EZTxt17,EZTxt18,EZTxt19,EZTxt20,EZTxt21,EZTxt22,EZTxt23,EZTxt24
- dc.l EZTxt25,EZTxt26,EZTxt27,EZTxt28,EZTxt29,EZTxt30
- **********************************************************************
- * Error texts for IFFParse *
- **********************************************************************
- IFFErrors dc.l 0,0,0,IFFTxt3,IFFTxt4,IFFTxt5,IFFTxt6,IFFTxt7,IFFTxt8,IFFTxt9
- dc.l IFFTxt10
- **********************************************************************
- * Error texts for printer *
- **********************************************************************
- PrinterErrors dc.l 0,PrtTxt2,PrtTxt3,0,PrtTxt5,0,PrtTxt7,PrtTxt8
-
-
- **********************************************************************
- * Texts to be localized *
- **********************************************************************
- LOCALE_START
- * CATALOG kcxlib
- * VERSION 2.5
- * DATE 01.02.93
- EZTxt1 dc.b "%s could not be opened.",0
- * D "%s konnte nicht geoeffnet werden.",0
- EZTxt2 dc.b "Broker-Port could not be created.",0
- * D "Broker-Port konnte nicht erstellt werden.",0
- EZTxt3 dc.b "Broker could not be set up.",0
- * D "Broker konnte nicht gestartet werden-",0
- EZTxt4 dc.b "Broker could not be set up correctly.",0
- * D "Broker konnte nicht richtig installiert werden.",0
- EZTxt5 dc.b "Could not generate BitMap.",0
- * D "Konnte BitMap nicht erzeugen.",0
- EZTxt6 dc.b "Could not generate RastPort.",0
- * D "Konnte RastPort nicht erzeugen.",0
- EZTxt7 dc.b "Could not allocate memory for BitPlanes.",0
- * D "Konnte Speicher für BitMaps nicht allokieren.",0
- EZTxt8 dc.b "Could not set appropriate font.",0
- * D "Konnte richtigen Zeichensatz nicht setzen.",0
- EZTxt9 dc.b "Could not allocate memory for ARexx-Buffer.",0
- * D "Konnte Speicher für ARexx-Puffer nicht allokieren.",0
- EZTxt10 dc.b "Could not allocate memory for Audio-Request.",0
- * D "Konnte Speicher für Audio-Request nicht allokieren.",0
- EZTxt11 dc.b "Could not allocate memory for Console-Request.",0
- * D "Konnte Speicher für Console-Request nicht allokieren.",0
- EZTxt12 dc.b "Could not set up ARexx-Port.",0
- * D "Konnte ARexx-Port nicht öffnen.",0
- EZTxt13 dc.b "Out of memory.",0
- * D "Fehlender Speicher.",0
- EZTxt14 dc.b "Audio-Port could not be set up.",0
- * D "Audio-Port konnte nicht initialisiert werden.",0
- EZTxt15 dc.b "Default HotKey",$0a,$0a
- dc.b "%s",$0a,$0a
- dc.b "could not be set up. Aborting",0
- * D "Voreingestellter HotKey",10,10
- * D "%s",10,10
- * D "konnte nicht initialisiert werden. Abbruch",0
- EZTxt16 dc.b "The AppIcon could not be installed.",0
- * D "Das AppIcon konnte nicht installiert werden.",0
- EZTxt17 dc.b "The AppMenu could not be installed.",0
- * D "Das AppMenu konnte nicht installiert werden.",0
- EZTxt18 dc.b "The Preferences-File you attempted to",$0a
- dc.b " load was not generated with",$0a
- dc.b " KCommodity V%s",10
- dc.b " Unable to load preferences.",0
- * D "Sie haben versucht eine Einstellungsdatei",10
- * D " zu laden, die nicht mit",10
- * D " KCommodity V%s",10
- * D "erzeugt wurde. Kann die Daten nicht lesen.",0
- EZTxt19 dc.b "Memory for InputRequest could not be allocated.",0
- * D "Speicher für InputRequest konnte nicht allokiert werden.",0
- EZTxt20 dc.b "MessagePort for InputRequest could not be created.",0
- * D "MessagePort für InputRequest konnte nicht erzeugt werden.",0
- EZTxt21 dc.b "InputHandler could not be installed.",0
- * D "InputHandler konnte nicht installiert werden.",0
- EZTxt22 dc.b "Could not allocate IFF-Handle for access to file.",0
- * D "Konnte IFF-Handle nicht allokieren,",10
- * D "um Zugriff auf die Datei zu bekommen.",0
- EZTxt23 dc.b "User HotKey",$0a,$0a
- dc.b "%s",$0a,$0a
- dc.b "could not be installed.",$0a,$0a
- dc.b "Now using default : %s",0
- * D "Benutzer HotKey",10,10
- * D "%s",10,10
- * D "konnte nicht installiert werden",0
- EZTxt24 dc.b "Please check your inputs.",0
- * D "Überprüfen Sie Ihre Eingaben.",0
- EZTxt25 dc.b "Can`t dump.",$0a
- dc.b "Needed resources for printer.device",$0a
- dc.b "could not be allocated.",0
- * D "Kann nicht drucken.",10
- * D "Geforderte Resourcen für das printer.device",10
- * D "konnten nicht allokiert werden.",0
- EZTxt26 dc.b "This window can not be identified",$0a
- dc.b "by it`s title. I can`t handle something like that.",0
- * D "Dieses Fenster kann nicht anhand seiner Titelleiste",10
- * D "erkannt werden. So etwas kann ich nicht handhaben.",0
- EZTxt27 dc.b "Could not allocate User Task-Signal.",0
- * D "Konnte Benutzer Task-Signal nicht allokieren.",0
- EZTxt28 dc.b "Shared IDCMP-Port for windows could",$0a
- dc.b "not be allocated.",0
- * D "Geteilter IDCMP-Port für Fenster konnte",10
- * D "nicht allokiert werden.",0
- EZTxt29 dc.b "Could not allocate Port for trackdisk.device.",0
- * D "Port für trackdisk.device konnte nicht allokiert werden.",0
- EZTxt30 dc.b "Can not quit yet.",10
- dc.b "Print-Process still running.",0
- * D "Kann jetzt noch nicht beenden.",10
- * D "Druck-Prozess läuft noch.",0
- IFFTxt3 dc.b "Did not get a valid scope for property on IFF file.",0
- * D "Konnte keinen Zugriff auf die Daten der IFF-Datei bekommen",0
- IFFTxt4 dc.b "Memory allocation failed while",$0a
- dc.b "loading IFF file.",0
- * D "Speicher-Allokierung, während des Ladens der",10
- * D "IFF-Datei, fehlgeschlagen.",0
- IFFTxt5 dc.b "Read error occured during examination",$0a
- dc.b "of IFF file.",0
- * D "Lesefehler aufgetreten, während der",10
- * D "Untersuchung der IFF-Datei.",0
- IFFTxt6 dc.b "Write error while writing to IFF file.",0
- * D "Schreibfehler beim Schreiben in die IFF Datei",0
- IFFTxt7 dc.b "Seek error within IFF file.",0
- * D "Suchfehler innerhalb der IFF Datei.",0
- IFFTxt8 dc.b "Data corrupt within IFF file.",0
- * D "Daten zerstört innerhalb der IFF Datei.",0
- IFFTxt9 dc.b "IFF syntax in bad condition, could",$0a
- dc.b "not load IFF file correctly.",0
- * D "IFF Syntax innerhalb der Datei in schlechtem Zustand.",10
- * D "Konnte die Daten nicht richtig laden.",0
- IFFTxt10 dc.b "The file %s ",$0a
- dc.b "you attempted to load is not",$0a
- dc.b "an IFF file.",0
- * D "Die Datei %s,",10
- * D "die Sie laden wollten, ist keine IFF Datei.",0
- PrtTxt2 dc.b "Dump canceled on user request.",0
- * D "Ausdruck, auf Wunsch des Benutzers, abgebrochen.",0
- PrtTxt3 dc.b "Selected printer",$0a
- dc.b "%s",$0a
- dc.b "does not support Graphics dumps.",0
- * D "Gewählter Drucker",10
- * D "%s",10
- * D "unterstützt leider keinen Graphikdruck.",0
- PrtTxt5 dc.b "Bad dimensions specified for printout.",0
- * D "Schlechte Dimensionen für den Ausdruck angegeben.",0
- PrtTxt7 dc.b "printer.device could not allocate",$0a
- dc.b "internal variables.",0
- * D "printer.device konnte interne",10
- * D "Variablen nicht allokieren.",0
- PrtTxt8 dc.b "printer.device could not allocate",$0a
- dc.b "internal buffers",0
- * D "printer.device konnte interne",10
- * D "Puffer nicht allokieren.",0
- DosError dc.b "DOS-Error ",0
- * D "DOS-Fehler ",0
- LOCALE_END
- EVEN
-
-
- **********************************************************************
- * Special define for Dos-Errors *
- **********************************************************************
- DosErrorBuff ds.b 128
- EVEN
-
-
-
-
- **********************************************************************
- * Text attribute for gadgets. We are stubborn. Let`s take topaz :-) *
- **********************************************************************
- GadgetTxtAttr dc.l 0
- dc.w 8
- dc.b FS_NORMAL
- dc.b FPF_ROMFONT
- TopazTxtAttr dc.l FontName
- dc.w 8
- dc.b FS_NORMAL
- dc.b FPF_ROMFONT
- FontName dc.b "topaz.font",0
- EVEN
-
-
-
-
-
-
- SECTION Library,DATA_C
-
- **********************************************************************
- * Busy pointer image *
- **********************************************************************
- BusyPtr DC.W $0000,$0000,$0400,$07C0,$0000,$07C0
- DC.W $0100,$0380,$0000,$07E0,$07C0,$1FF8
- DC.W $1FF0,$3FEC,$3FF8,$7FDE,$3FF8,$7FBE
- DC.W $7FFC,$FF7F,$7EFC,$FFFF,$7FFC,$FFFF
- DC.W $3FF8,$7FFE,$3FF8,$7FFE,$1FF0,$3FFC
- DC.W $07C0,$1FF8,$0000,$07E0,$0000,$0000
-
-
- EndOfLibrary
- END